'''
Created on 19/08/2012

@author: Nrai
'''
from base import Error

class PaletteException(Error):
    pass


class PaletteHandlingError(PaletteException):
    
    def __init__(self, msg=None):
            
            self.msg = '''Unknown palette type {m}'''.format(m = msg)
            super(Error, self).__init__(self.msg)


class PaletteError(PaletteException):
    
        def __init__(self, msg=None):
            
            self.msg = '''Bad palette {m}'''.format(m = msg)
            super(Error, self).__init__(self.msg)
       
       
class PaletteFileError(PaletteException):
    def __init__(self, msg=None):
            
            self.msg = '''Bad palette file {m}'''.format(m = msg)
            super(Error, self).__init__(self.msg) 


class PaletteLengthError(PaletteException):
    
    def __init__(self, length, palette_length):
        self.msg = ('''Bad palette, length should be {le}
                     found {pl} instead'''.format(
                                                  le = length,
                                                  pl = palette_length,
                                                  )
                    )
        super(Error, self).__init__(self.msg)
        
        
class PaletteFormatError(PaletteException):
    
    def __init__(self, char):
        self.msg = ('''Bad palette, error decoding{c}'''.format(
                                                                c = char
                                                                )
                    )
        super(Error, self).__init__(self.msg)
        
        
class PaletteValueError(PaletteException):
    
    def __init__(self, char):
        self.msg = ('''Bad palette, 
                    must contain only numeric values, {c}'''.format(
                                                                  c = char
                                                                  )
                    )
        super(Error, self).__init__(self.msg)
        
        
class PaletteRangeError(PaletteException):
    
    def __init__(self, char):
        self.msg = ('''Bad palette, 
                    values must be 0 - 255, {c}'''.format(
                                                    c = char
                                                    )
                    )
        super(Error, self).__init__(self.msg)